Dialog

Kind of class:class
Inherits from:UIComponent < MovieClip
Classpath:gfx.controls.Dialog
File last modified:Tuesday, 29 June 2010, 09:03:27
The CLIK Dialog component displays a dialog view, such as an Alert dialog, on top of the rest of the application. It provides a static interface to instantiate, show and hide any MovieClip as a dialog, as well as a base class that can be used (extended) as the actual dialog MovieClip. To ensure only a single dialog is open at once, new Dialog.show() calls will close the currently open dialog.

Inspectable Properties
A MovieClip that derives from the Dialog component will have the following inspectable properties:
  • visible: Hides the component if set to false.
  • disabled: Disables the component if set to true.
  • enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
  • soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects.
States
There are no states for the Dialog component. The MovieClip displayed as the dialog view may or may not have its own states.

Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
  • type: The event type.
  • target: The target that generated the event.
The events generated by the Dialog component are listed below. The properties listed next to the event are provided in addition to the common properties.
  • show: The component’s visible property has been set to true at runtime.
  • hide: The component’s visible property has been set to false at runtime.
  • submit: The submit button of the Dialog has been clicked.
    • data: The submitted data of the Dialog. The Dialog component’s getSubmitData method is invoked for this property, and should be overridden by custom dialog boxes. The default value returned is true (Boolean). The return value of getSubmitData is AS2 Object.
  • close: The close button of the Dialog has been clicked.
Component metadata:
    InspectableList
    "disabled"
    "enableInitCallback"
    "soundMap"
    "visible"

    Summary


    Constructor
    Class properties
    • currentDialog
      • A reference to the current, open dialog.
    • open
      • Determines if there is a currently open dialog.
    Instance properties
    • title
      • The optional title of a dialog.
    • message
      • The optional message of a dialog.
    • soundMap
      • Mapping between events and sound process
    • closeBtn
      • An optional Button UI element used as a "close" button.
    • cancelBtn
      • An optional Button UI element used as a "cancel" button.
    • submitBtn
      • An optional Button UI element used as a submit button.
    • dragBar
      • An optional Button UI element used to drag the Dialog around the stage.
    Class methods
    • show
      • Create a Dialog instance using the PopUpManager.
    • hide
      • Remove the current dialog from the stage.
    Class methods inherited from UIComponent

    Constructor

    Dialog

    function Dialog (
    )

    The constructor is called when a Dialog or a sub-class of Dialog is instatiated on stage or by using attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend Dialog, ensure that a super() call is made first in the constructor.

    Class properties

    currentDialog

    static currentDialog:MovieClip
    (read,write)

    A reference to the current, open dialog.

    open

    static open:Boolean = false
    (read,write)

    Determines if there is a currently open dialog.

    Instance properties

    cancelBtn

    cancelBtn:Button
    (read,write)

    An optional Button UI element used as a "cancel" button. When clicked, a "close" event is dispatched.

    closeBtn

    closeBtn:Button
    (read,write)

    An optional Button UI element used as a "close" button. When clicked, a "close" event is dispatched.

    dragBar

    dragBar:MovieClip
    (read,write)

    An optional Button UI element used to drag the Dialog around the stage.

    message

    message:String
    (read,write)

    The optional message of a dialog. Only defined when it is passed in the initObject of Dialog.show().

    soundMap

    soundMap:Object = { theme:"default", close:"close", submit:"submit" }
    (read,write)

    Mapping between events and sound process

    submitBtn

    submitBtn:Button
    (read,write)

    An optional Button UI element used as a submit button. When clicked, a "submit" event is dispatched, containing a data property which is the value of the getSubmitData() method.

    title

    title:String
    (read,write)

    The optional title of a dialog. Only defined when it is passed in the initObject of Dialog.show().

    Class methods

    hide

    static function hide (
    ) : Void

    Remove the current dialog from the stage. The hide() method destroys the dialog using removeMovieClip(), which automatically cleans up dialogs extending UIComponent.

    show

    static function show (
    context:MovieClip, linkage:String, props:Object, modal:Boolean) : MovieClip

    Create a Dialog instance using the PopUpManager. The dialog is pre-populated with initialization data, and centered on the stage. The calling object can add event listeners for "close" and "submit" events when using the default Dialog class, or custom events dispatched from custom dialogs.

    var dialog:MovieClip = Dialog.show("DialogSymbol", props, true);
    dialog.addEventListener("submit", this, "handleSubmit");
    function handleSubmit(event:Object):Void;
    Parameters:
    context:
    The context used to create the popup instance. Typically this would be the source for the dialog.
    linkage:
    The library linkage to attach as a dialog.
    props :
    Properties specific to the dialog.
    modal :
    Determines if the modal blocks user interaction of other controls outside the Dialog while open.
    Returns:
    • A reference to the newly-created dialog.